#pragma config(Hubs,  S1, HTMotor,  HTMotor,  none,     none)
#pragma config(Sensor, S1,     ,               sensorI2CMuxController)
#pragma config(Motor,  mtr_S1_C1_1,     leftFront,     tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C1_2,     leftRear,      tmotorTetrix, openLoop)
#pragma config(Motor,  mtr_S1_C2_1,     rightFront,    tmotorTetrix, openLoop, reversed)
#pragma config(Motor,  mtr_S1_C2_2,     rightRear,     tmotorTetrix, openLoop, reversed)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

#pragma debuggerWindows("joystickGame");

#include "JoystickDriver.c"
#include "motors.c"

task main()
{
	const int DEAD_ZONE = 15;
	InitMotors(leftFront,leftRear,rightFront,rightRear);
	waitForStart();
	while(true)
	{
		getJoystickSettings(joystick);

		// Left Motor Control //
		if(abs(joystick.joy1_y1) > DEAD_ZONE)
		{
			DriveLeftMotors(joystick.joy1_y1);
		}
		else
		{
			DriveLeftMotors(0);
		}

		// Right Motor Control //
		if(abs(joystick.joy1_y2) > DEAD_ZONE)
		{
			DriveRightMotors(joystick.joy1_y2);
		}
		else
		{
			DriveRightMotors(0);
		}
	}
}
